<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
</body>
<script>
  // 检测数据
  let car = {}
  let val = 3000
  Object.defineProperty(car, 'price', {
    enumerable: true,
    configurable: true,
    get(){
      console.log('price属性被读取了')
      return val
    },
    set(newVal){
      console.log('price属性被修改了')
      val = newVal
    }
  })
</script>
</html>